package com.ruoyi.web.controller.solidProdution;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.solidProdution.domain.ZcktzInfo;
import com.ruoyi.solidProdution.service.IZcktzInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 暂存库台账Controller
 * 
 * @author ruoyi
 * @date 2021-09-02
 */
@RestController
@RequestMapping("/solidProdution/zcktzInfo")
public class ZcktzInfoController extends BaseController
{
    @Autowired
    private IZcktzInfoService zcktzInfoService;

    /**
     * 查询暂存库台账列表
     */
    @PreAuthorize("@ss.hasPermi('solidProdution:zcktzInfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(ZcktzInfo zcktzInfo)
    {
        startPage();
        List<ZcktzInfo> list = zcktzInfoService.selectZcktzInfoList(zcktzInfo);
        return getDataTable(list);
    }

    /**
     * 导出暂存库台账列表
     */
    @PreAuthorize("@ss.hasPermi('solidProdution:zcktzInfo:export')")
    @Log(title = "暂存库台账", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(ZcktzInfo zcktzInfo)
    {
        List<ZcktzInfo> list = zcktzInfoService.selectZcktzInfoList(zcktzInfo);
        ExcelUtil<ZcktzInfo> util = new ExcelUtil<ZcktzInfo>(ZcktzInfo.class);
        return util.exportExcel(list, "暂存库台账数据");
    }

    /**
     * 获取暂存库台账详细信息
     */
    @PreAuthorize("@ss.hasPermi('solidProdution:zcktzInfo:query')")
    @GetMapping(value = "/{zcktzId}")
    public AjaxResult getInfo(@PathVariable("zcktzId") Long zcktzId)
    {
        return AjaxResult.success(zcktzInfoService.selectZcktzInfoById(zcktzId));
    }

    /**
     * 新增暂存库台账
     */
    @PreAuthorize("@ss.hasPermi('solidProdution:zcktzInfo:add')")
    @Log(title = "暂存库台账", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ZcktzInfo zcktzInfo)
    {
        return toAjax(zcktzInfoService.insertZcktzInfo(zcktzInfo));
    }

    /**
     * 修改暂存库台账
     */
    @PreAuthorize("@ss.hasPermi('solidProdution:zcktzInfo:edit')")
    @Log(title = "暂存库台账", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ZcktzInfo zcktzInfo)
    {
        return toAjax(zcktzInfoService.updateZcktzInfo(zcktzInfo));
    }

    /**
     * 删除暂存库台账
     */
    @PreAuthorize("@ss.hasPermi('solidProdution:zcktzInfo:remove')")
    @Log(title = "暂存库台账", businessType = BusinessType.DELETE)
	@DeleteMapping("/{zcktzIds}")
    public AjaxResult remove(@PathVariable Long[] zcktzIds)
    {
        return toAjax(zcktzInfoService.deleteZcktzInfoByIds(zcktzIds));
    }
}
